package com.hmy.finance.api.bo.core.request.enums;

import lombok.Getter;

/**
 * 盈亏类型枚举
 *
 * @author songkf
 */

@Getter
public enum ProfitLossTypeEnum {
    PROFIT("1", "盈利"),
    LOSS("2", "亏损");

    private final String value;
    private final String desc;

    ProfitLossTypeEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 根据value获取desc
     *
     * @param value value
     * @return desc
     * @author songkf
     */
    public static String getDescByValue(String value) {
        for (ProfitLossTypeEnum businessBillTypeEnum : ProfitLossTypeEnum.values()) {
            if (businessBillTypeEnum.getValue().equals(value)) {
                return businessBillTypeEnum.getDesc();
            }
        }
        return null;
    }
}
